import java.util.LinkedList;
import java.util.List;

public class TempVarTable {
    LinkedList<String> table;
    public TempVarTable(){
        table = new LinkedList<String>();
    }
    public Identifier getNewTempVar(){
        int index = table.size();
        String name = "T" + index;
        table.addLast(name);
        return new Identifier(name);
    }

    public String dump() {
        StringBuilder s = new StringBuilder();
        s.append("tempvar table:\n");
        for (String s1 : table) {
            s.append(s1).append("; ").append("\n");
        }
        return s.toString();
    }
    public void clear() {
        table.clear();
    }
}
